import request from '@/utils/request';
import { getToken } from '@/utils/auth'
export default{
  //用户添加提交submit设置
  aduser(list){
    return request({
      method: 'POST',
      url: '/user/create',
      data:list
    })
  },
   //用户修改设置
   updateuser(id){
    return request({
        method: 'GET',
        url: '/user?user_id=' + id,
    })
  },
  //y用户状态
  lockuser(id,status){
    return request({
      url:`/user/update/userStatus/${id}/${status}`,
      method:'POST',
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //用户列表
  userList(page_num,page_size){
    return request({
      url:`/user/list?page_num=${page_num}&page_size=${page_size}`,
      method:'GET',
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //用户删除
  deleteUser(user_id){
    return request({
      method: 'DELETE',
		  url: "/user?user_id=" + user_id,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //查找用户
  searchUser(user_id){
    return request({
      method: "GET",
        url: "/user?user_id=" + user_id,
        headers: {
                'Authorization':getToken()
              }
    })
  },
  //已学课程进度
  Usercourseprogress(user_id){
    return request({
      method: "GET",
        url: "/course/myCourse?user_id=" + user_id,
        headers: {
                'Authorization':getToken()
              }
    })
  },

  //查看收获地址
  searchaddress(user_id){
    return request({
      method: "GET",
        url: "/user/address?user_id=" + user_id,
        headers: {
                'Authorization':getToken()
              }
    })
  },
  //收藏课程
  UsercollCourse(user_id){
    return request({
      method: "GET",
      url: "/course/collect?pageNum=1&pageSize=5&userId=" + user_id,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  //收藏商品
  UsercollGoods(user_id){
    return request({
      method: "GET",
      url: "/mall/collections?pageNum=1&pageSize=5&userId=" + user_id,
      headers: {
              'Authorization':getToken()
            }
    })
  },
   //收藏文章
   UsercollArticle(user_id){
     return request({
      method: "GET",
      url: "/article/collections?pageNum=1&pageSize=5&userId=" + user_id,
      headers: {
              'Authorization':getToken()
            }
     })
   }
}
